# coding: utf-8
from sqlalchemy import Column, DateTime, Float, ForeignKey, Integer, LargeBinary, Text
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class Result(Base):
    __tablename__ = 'Result'

    SampleId = Column(DateTime, primary_key=True)
    SampleName = Column(Text)
    SampleNum = Column(Text)
    SampleWeight = Column(Float, nullable=False)
    SampleUnit = Column(Text)
    FluxWeight = Column(Float)
    Content01 = Column(Float)
    Content02 = Column(Float)
    Content03 = Column(Float)
    Area01 = Column(Float)
    Area02 = Column(Float)
    Area03 = Column(Float)
    Channel = Column(Integer)
    Area1 = Column(Float)
    Area2 = Column(Float)
    Area3 = Column(Float)
    Area4 = Column(Float)
    Area5 = Column(Float)
    Area6 = Column(Float)
    Content1 = Column(Float)
    Content2 = Column(Float)
    Content3 = Column(Float)
    Content4 = Column(Float)
    Content5 = Column(Float)
    Content6 = Column(Float)
    Content10 = Column(Float)
    Content20 = Column(Float)
    Content30 = Column(Float)
    Content40 = Column(Float)
    Content50 = Column(Float)
    Content60 = Column(Float)
    MethodName = Column(Text)
    UserName = Column(Text)
    ResultUnit1 = Column(Text)
    ResultUnit2 = Column(Text)


class Datum(Result):
    __tablename__ = 'Data'

    SampleId = Column(ForeignKey('Result.SampleId'), primary_key=True)
    Channels = Column(LargeBinary)
    Factors = Column(LargeBinary)
    Averages = Column(LargeBinary)
    LineFactor = Column(Float)
    DataTime = Column(LargeBinary)
    DataChannel1 = Column(LargeBinary)
    DataChannel2 = Column(LargeBinary)
    DataChannel3 = Column(LargeBinary)
    DataChannel4 = Column(LargeBinary)
    DataChannel5 = Column(LargeBinary)
    DataChannel6 = Column(LargeBinary)
    DataChannelDelay1 = Column(LargeBinary)
    DataChannelDelay2 = Column(LargeBinary)
    DataChannelDelay3 = Column(LargeBinary)
    DataChannelDelay4 = Column(LargeBinary)
    AverageVs = Column(LargeBinary)
